package com.gong.gongcloudpicture1.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gong.gongcloudpicture1.common.BaseResponse;
import com.gong.gongcloudpicture1.model.dto.picture.PictureQueryRequest;
import com.gong.gongcloudpicture1.model.dto.user.*;
import com.gong.gongcloudpicture1.model.entity.picture.Picture;
import com.gong.gongcloudpicture1.model.entity.user.User;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gong.gongcloudpicture1.model.vo.picture.PictureVO;
import com.gong.gongcloudpicture1.model.vo.user.UserLoginVo;
import com.gong.gongcloudpicture1.model.vo.user.UserVO;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
* @author g1783
* @description 针对表【user(用户)】的数据库操作Service
* @createDate 2025-05-23 20:50:37
*/
public interface UserService extends IService<User> {


    /**
     * 用户注册
     * @param userRegisterRequest
     * @return
     */
    BaseResponse<Long> userRegister(UserRegisterRequest userRegisterRequest);


    /**
     * 用户登录, 登录成功后返回脱敏信息
     * @param userLoginRequest
     * @param request
     * @return
     */
    BaseResponse<UserLoginVo> login(UserLoginRequest userLoginRequest, HttpServletRequest request);


    /**
     * 获取当前登录用户
     * @param request
     * @return
     */
    BaseResponse<UserLoginVo> getLogInUser(HttpServletRequest request);



    User getLogInUser2(HttpServletRequest request);

    /**
     * 用户注销
     * @param request
     * @return
     */
    BaseResponse<Boolean> logout(HttpServletRequest request);


    /**
     * 获取脱敏用户信息
     * @param user
     * @return
     */
    UserVO getUserVo(User user);


    /**
     * 批量获取脱敏用户信息
     * @param userList
     * @return
     */
    List<UserVO> getUserVoList(List<User> userList);


    /**
     * 获取用户分页查询条件
     * @param userQueryRequest
     * @return
     */
    QueryWrapper<User> getQueryWrapper(UserQueryRequest userQueryRequest);


    /**
     * 创建用户
     * @param userAddRequest
     * @return
     */
    BaseResponse<Long> addUser(UserAddRequest userAddRequest);


    /**
     * 通过id获取用户(管理员可操作)
     * @param id
     * @return
     */
    BaseResponse<User> getUserById(Long id);


    /**
     * 更新用户
     * @param userUpdateRequest
     * @return
     */
    BaseResponse<Boolean> updateUser(UserUpdateRequest userUpdateRequest);


    /**
     * 用户分页
     * @param userQueryRequest
     * @return
     */
    BaseResponse<Page<UserVO>> listUserVoByPage(UserQueryRequest userQueryRequest);


    /**
     * 判断是否为管理员
     * @param user
     * @return
     */
    boolean isAdmin(User user);
    boolean isAdmin(UserLoginVo user);
}
